<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>字符串内置</title>
</head>
<style>
    *{
        padding: 0;
        margin: 0;
        font-size: 20px;
        margin: 10px;
    }

    div{
        padding: 5px;
        margin-left: 0px;
        border: 1px solid #686868;
    }
</style>
<body>
    <script>
        // charAt()
        var str = 'hello'
        var char = str.charAt(2)
        document.write('"hello".charAt(2)----'+char+'<br>')
        document.write('<div>字符串.charAt()   返回指定 位置 字符</div>')

        // charCodeAt()
        var str = 'hello'
        var char = str.charCodeAt(1); // 101
        document.write('"hello".charCodeAt(1)----'+char+'<br>')
        document.write('<div>字符串.charCodeAt()   返回指定位置的 字符 的Unicode 编码  ASCII码</div>')

    </script>
</body>
</html>